package com.mask.eurekaconsumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;

import java.io.IOException;

@Slf4j
public class LoginClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
    @Override
    public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
        log.info("客户端拦截请求中...");
        log.info("拦截的地址是:{}",request.getURI());
        ClientHttpResponse response = execution.execute(request, body);
        log.info("拦截的请求头:{}",response.getHeaders());

        return response;
    }
}
